
const openHref = (href) => {
    if (window.em && (typeof window.em.checkJsApi === 'function') && window.em.checkJsApi('openLink')) {
      window.em.openLink({
        url: href,
        openType: 2
      });
    } else {
      window.open(href);
    }
  }
//兼容老数据
const openAppLink_old = (obj, linkid) => {
    let linkType=obj.getAttribute("linktype");
    if(linkType=="doc")
       openHref(
        `/spa/document/static4mobile/index.html#/doc/${linkid}`
        );
    else if(linkType=="task")
        openHref(
            "/proj/process/ViewTask.jsp?moduleid=blog&taskrecordid=" +
            linkid +
            "&linkType=" +
            linkType +
            "&linkid=" +
            linkid
        );
    else if(linkType=="crm")
        openHref(
            "/spa/crm/static/index.html#/main/crm/customerView?moduleid=blog&customerId=" +
            linkid +
            "&linkType=" +
            linkType +
            "&linkid=" +
            linkid
        );
    else if(linkType=="workflow")
        openHref(
            "/spa/workflow/static4mobileform/index.html#/req?requestid=" +
            linkid +
            "&linkType=" +
            linkType +
            "&linkid=" +
            linkid
        );
    else if(linkType=="project")
        openHref(
            "/spa/prj/index.html#/main/prj/projectCard?moduleid=blog&prjid=" +
            linkid +
            "&linkType=" +
            linkType +
            "&linkid=" +
            linkid
        );
    else if(linkType=="workplan")
        openHref(
            "/spa/workplan/static/index.html#/main/wp/workPlanCreateSingle?moduleid=blog&workid=" +
            linkid +
            "&linkType=" +
            linkType +
            "&linkid=" +
            linkid
        );
    return false;
  };
  
  export default openAppLink_old;